<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>添加</title>
    <#assign base=request.contextPath  />
    <base id="base" href="${base}">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, adminUser-scalable=0">
    <link rel="stylesheet" href="${base}/static/win10/component/layui/css/layui.css" media="all">
    <script>
        var base =  "${base}";
    </script>
</head>
<body>
<br>
<form class="layui-form " action="">
         <input type="hidden" id="id" name="id" value="${stationInfoLansi.id!}" >
          <div class="layui-form-item">
              <label class="layui-form-label">站点编号</label>
              <div class="layui-input-block">
                  <input type="text" id="stationIndex" name="stationIndex" value="${stationInfoLansi.stationIndex!}"  autocomplete="off" placeholder="请输入站点编号"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">站点id</label>
              <div class="layui-input-block">
                  <input type="text" id="stationId" name="stationId" value="${stationInfoLansi.stationId!}"  autocomplete="off" placeholder="请输入站点id"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">纬度</label>
              <div class="layui-input-block">
                  <input type="text" id="longitude" name="longitude" value="${stationInfoLansi.longitude!}"  autocomplete="off" placeholder="请输入纬度"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">经度</label>
              <div class="layui-input-block">
                  <input type="text" id="latitude" name="latitude" value="${stationInfoLansi.latitude!}"  autocomplete="off" placeholder="请输入经度"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">线路id</label>
              <div class="layui-input-block">
                  <input type="text" id="routeId" name="routeId" value="${stationInfoLansi.routeId!}"  autocomplete="off" placeholder="请输入线路id"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">站点名称</label>
              <div class="layui-input-block">
                  <input type="text" id="stationName" name="stationName" value="${stationInfoLansi.stationName!}"  autocomplete="off" placeholder="请输入站点名称"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">上下行</label>
              <div class="layui-input-block">
                  <input type="text" id="upDown" name="upDown" value="${stationInfoLansi.upDown!}"  autocomplete="off" placeholder="请输入上下行"
                         class="layui-input">
              </div>
          </div>

    <div align="center">
        <button type="button" class="layui-btn" id="submit">保存</button>
    </div>
</form>

<script src="${base}/static/win10/component/layui/layui.js?t=1"></script>
<script src="${base}/static/win10/js/jquery-1.8.3.min.js?t=1"></script>
<script>
    layui.use(['form', 'layer'], function() {
        var form = layui.form
                , layer = layui.layer;
        $("#submit").on("click",function () {
            if(check()===false){
                return;
            }

            var formDate = {
                         id:$("#id").val(),
                         stationIndex:$("#stationIndex").val(),
                         stationId:$("#stationId").val(),
                         longitude:$("#longitude").val(),
                         latitude:$("#latitude").val(),
                         routeId:$("#routeId").val(),
                         stationName:$("#stationName").val(),
                           upDown:$("#upDown").val()
            }
            $.ajax({
                type: "POST",
                url: base+"/bus/stationInfoLansi/editStationInfoLansi",
                data: formDate,
                success: function (data) {
                    layer.msg(data.message)
                    if (data.code === 200) {
                        window.location.href=base+"/bus/stationInfoLansi/main.html"
                    } else {

                    }
                }
            });
        })







        function check(){
                   if($("#stationIndex").val().length<1){
                       layer.msg("请输入站点编号");
                       return false;
                   }
                   if($("#stationId").val().length<1){
                       layer.msg("请输入站点id");
                       return false;
                   }
                   if($("#longitude").val().length<1){
                       layer.msg("请输入纬度");
                       return false;
                   }
                   if($("#latitude").val().length<1){
                       layer.msg("请输入经度");
                       return false;
                   }
                   if($("#routeId").val().length<1){
                       layer.msg("请输入线路id");
                       return false;
                   }
                   if($("#stationName").val().length<1){
                       layer.msg("请输入站点名称");
                       return false;
                   }
                   if($("#upDown").val().length<1){
                       layer.msg("请输入上下行");
                       return false;
                   }
        }
    });

</script>
</body>
</html>